const https = require('https')
const cheerio = require('cheerio')


// https.get('https://www.tupianzj.com/meinv/mm/meituwang/', (res) => {
//     res.setEncoding('utf-8')
//     let rawData = ''
//     let imgArr =[];
//     res.on('data', (chunk) => {
//         rawData += chunk
//     })
//     res.on('end', () => {
//         const $ = cheerio.load(rawData)
//         $('img').each((i, el)=> {
//          imgArr.push($(el).attr('src'))
      
//         })
//         console.log(imgArr)
//     })
// }).on('error', (e) => {
//     console.error(`出现错误:${e.message}`)
// })

https.get('https://www.tupianzj.com/meinv/mm/meituwang/', (res) => {
  res.setEncoding('utf-8');
  let rawData = '';
  let rawArr = []
  res.on('data', (chunk) => {
    rawData+=chunk
    });

  res.on('end', () => {
   const $ = cheerio.load(rawData)
   $('img').each((i,el)=>{
    rawArr.push($(el).attr('src'))

   })

   console.log(rawArr)
  });
}).on('error', (e) => {
  console.error(`出现错误: ${e.message}`);
});